<template>
  <div>
    <button @click="editTitle.editUser">editUser</button>
    <button @click="editTitle.edit">edit</button>
    <button @click="editTitle.update">update</button>
    <button @click="editTitle.change">change</button>
  </div>
</template>

<script lang="ts" setup>
export interface Iuser {
  name:string
  sex:string
  age:number
}
const emit = defineEmits<{
  (e: 'change', id: number): void;
  (e: 'update', val: string): void;
  (e: 'edit', val1:string,val2:number): void;
  (e: 'editUser', user:Iuser): void;
}>();

const editTitle ={
  editUser:function(){
    emit('editUser',{name:'坤哥',age:2.5,sex:'男神'})
  },
  edit:()=>{
    emit('edit','helloworld',18)
  },
  update:()=>{
    emit('update','helloworld')
  },
  change:()=>{
    emit('change',18)
  }
};
</script>
